package com.copro.chemdb.result;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.ihelpuoo.lang.StringUtils;

public class Answer {

	private int id;
	private int subjectId;
	private String strValue;
	private int intValue;
	private int resultId;
	private String text;

	public Answer(ResultSet rs) throws SQLException {
		this();
		this.id = rs.getInt("id");
		this.strValue = rs.getString("strvalue");
		this.text = rs.getString("text");
		this.subjectId = rs.getInt("id_T_subject");
		this.intValue = rs.getInt("intvalue");
		this.resultId = rs.getInt("id_T_result");
	}

	public Answer() {
		this.intValue = -1;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getSubjectId() {
		return subjectId;
	}

	public void setSubjectId(int subjectId) {
		this.subjectId = subjectId;
	}

	public String getStrValue() {
		return strValue;
	}

	public void setStrValue(String strvalue) {
		this.strValue = strvalue;
	}

	public int getIntValue() {
		return intValue;
	}

	public void setIntValue(int intvalue) {
		this.intValue = intvalue;
	}

	public int getResultId() {
		return resultId;
	}

	public void setResultId(int resultId) {
		this.resultId = resultId;
	}

	public boolean isBlank() {
		return StringUtils.isBlank(strValue) && intValue < 0;
	}

}
